package com.spring.boot.demo.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ZhuYouBin
 * @version 1.0.0
 * @Date: 2022/11/18 21:52
 * @Description
 */
@Configuration
public class AutoConfig {

    @Bean
    @ConfigurationProperties(prefix = "custom.spring.demo")
    public DemoConfig demoSource() {
        System.out.println("自动装配该类....");
        DemoConfig demoConfig = new DemoConfig();
        System.out.println(demoConfig.getDemoName());
        System.out.println(demoConfig.getDemoPass());
        return demoConfig;
    }

}
